package com.mall.db.domain;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 
 * </p>
 *
 * @author HQJ
 * @since 2021-09-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_send_message")
public class SendMessage extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 类型(sms:短信 email:邮件)
     */
    private String type;

    /**
     * 接收人
     */
    private String acceptUser;

    @TableField(exist = false)
    private List<String> acceptUsers;

    /**
     * 接收类型(all:所有  some:指定)
     */
    private String acceptType;

    /**
     * member:员工 , vip:会员
     */
    private String accept;

    /**
     * 信息标题
     */
    private String title;

    private String content;

    /**
     * 发送时间
     */
    private Date sendTime;

    /**
     * 发送状态 0：成功 1 ：失败
     */
    private Integer state;

    public Date getSendTime() {
        if(StringUtils.isEmpty(sendTime)){
            return new Date();
        }
        return sendTime;
    }
}
